var ProduceOrderData = function (config, data) {
  BaseModel.call(this);

  var self = this;
  var fn = {
    initData: function (config, data) {
      if (data === undefined) {
        this.initTestData(config);
        return;
      }

      var mode = data.mode;
      self.mode = mode;
      if (mode === 'create') {
        this.initCreateData(config, data);
      } else {
        this.initOrderData(config, data);
      }
    },

    initTestData: function (config) {
      self.sysOrderNo = "SC2020888888888";
      self.mode = "test";
      var materialColor = config.materialColor;
      var remarkList = materialColor.remarkList;
      var materialColorDataList = [];
      if (remarkList.length > 0) {
        var remarkData = _.maxBy(remarkList, 'lineNo');
        var maxLineNo = remarkData.lineNo;
        var remarkObj = _.groupBy(remarkList, 'lineNo');
        for (var i = 0; i < maxLineNo; i++) {
          var remark = remarkObj[i + 1];
          if (remark === undefined) {
            remark = '';
          } else {
            remark = remark[0].remark;
          }
          var data = new MaterialColorData({
            remark: remark
          }, 'test');
          materialColorDataList.push(data);
        }
      }
      self.materialColorDataList = materialColorDataList;
    },

    initCreateData: function (config, data) {
      self.busRes = data.busRes;
      self.bomRes = data.bomRes;
      self.sysOrderNo = data.sysOrderNo;
      self.wasteRateList = data.wasteRateList;
      this.initCreateOrderData(data);
      this.initCreateMaterialColorData(config);
    },

    initCreateOrderData: function (data) {
      var busData = self.busRes.titleBean;
      var busFields = ['orderNo', 'factoryNo', 'custmer', 'custmerOrderNo', 'custmerVersionNo', 'orderType', 'orderRemark'];
      self.setDataFromObj(busData, busFields, '');
      self.createUser = data.user.userName;

      var orderRemark = self.orderRemark;
      if (orderRemark !== '') {
        var text = $(orderRemark).text();
        if (text.trim() === '') {
          orderRemark = '';
        }
        self.orderRemark = orderRemark;
      }

      var otherData = data.otherData;
      if (otherData === undefined) {
        self.approvalUser = '';
        self.proDept = '';
      } else {
        self.approvalUser = otherData.approvalUser;
        self.proDept = otherData.proDept;
        self.businessId = otherData.businessId;
      }

      var deliveryTime = busData.deliveryTime;
      self.deliveryTime = moment(deliveryTime).format('YYYY-MM-DD');

      var bomData = self.bomRes.titleBean;
      var projectPicUrl = bomData.projectPicUrl;
      if (SysUtil.isEmpty(projectPicUrl)) {
        projectPicUrl = '';
      }
      self.projectPicUrl = projectPicUrl;
      self.serialNo = bomData.serialNo;
      var difficultLevelRate = bomData.difficultLevelRate;
      self.difficultLevelRate = Number(difficultLevelRate);

      var optionObj = {
        "圈开料尺寸": "ringSize",
        "肶开料尺寸": "legSize"
      };
      var bomMaterialList = data.bomRes.materialList;
      for (var i = 0; i < bomMaterialList.length; i++) {
        var obj = bomMaterialList[i];
        if (obj.materialCode === null) {
          var field = optionObj[obj.materialType];
          if (field !== undefined) {
            self[field] = obj.materialModel;
          }
        }
      }

      var produceRes = data.produceRes||{};
      var orderTime = produceRes.orderTime;
      if (orderTime === undefined) {
        self.orderTime = null;
      } else {
        self.orderTime = orderTime;
      }

      var fields = ['custNo'];
      fields.pushArray(OrderInfoConfigModel.orderMaterialFields);
      for (var i = 0; i < fields.length; i++) {
        var field = fields[i];
        var value = produceRes[field];
        if (SysUtil.isEmpty(value)) {
          value = '';
        }
        self[field] = value;
      }
    },

    initCreateMaterialColorData: function (config) {
      var bomRes = self.bomRes;
      var materialList = bomRes.materialList;
      var bomMaterialList = [],
        classifyMaterialList = [],
        subsidiaryMaterialList = [];
      for (var i = 0; i < materialList.length; i++) {
        var material = materialList[i];
        if (material.materialCode !== null) {
          var lineNo = material.lineNo;
          lineNo = Number(lineNo);
          if (lineNo === -1) {
            classifyMaterialList.push(material);
          } else if (lineNo >= 100 && lineNo !== 9999) {
            subsidiaryMaterialList.push(material);
          } else {
            bomMaterialList.push(material);
          }
        }
      }
      var bomMaterialGroup = _.groupBy(bomMaterialList, 'lineNo');

      var busRes = self.busRes;
      var busMaterialList = busRes.materialList;
      var busMaterialGroup = _.groupBy(busMaterialList, 'lineNo');
      var glassesList = busRes.glassMaterialBeans;
      var glassesGroup = _.groupBy(glassesList, 'lineNo');
      var deliveryDateList = busRes.dhTotalDates;
      var deliveryDateGroup = _.groupBy(deliveryDateList, 'lineNo');

      var remarkList = config.materialColor.remarkList;
      var remarkGroup = _.groupBy(remarkList, 'lineNo');
      var wasteRateList = self.wasteRateList;
      var mode = self.mode;
      var materialTypeList = [];
      var glassesMaterialTypeList = [];
      var materialColorDataList = [];
      var deliveryDateCount = 0;
      var orderCountList = [];
      var totalOrderCount = 0,
        totalFeedCount = 0,
        totalYltsCount = 0;
      for (var lineNo in busMaterialGroup) {
        var remark = remarkGroup[lineNo];
        if (remark === undefined) {
          remark = '';
        } else {
          remark = remark[0].remark;
        }

        var bomMaterials = bomMaterialGroup[lineNo];
        if (bomMaterials === undefined) {
          bomMaterials = [];
        }
        materialTypeList.pushArray(_.map(bomMaterials, 'materialType'));

        var glassesMaterials = glassesGroup[lineNo];
        if (glassesMaterials === undefined) {
          glassesMaterials = [];
        }
        glassesMaterialTypeList.pushArray(_.map(glassesMaterials, 'materialType'));

        var deliveryDates = deliveryDateGroup[lineNo];
        if (deliveryDates === undefined) {
          deliveryDates = [];
        }
        var len = deliveryDates.length;
        if (deliveryDateCount < len) {
          deliveryDateCount = len;
        }
        var obj = new MaterialColorData({
          lineNo: lineNo,
          bomMaterialList: bomMaterials,
          busMaterialList: busMaterialGroup[lineNo],
          glassesList: glassesMaterials,
          deliveryDateList: deliveryDates,
          wasteRateList: wasteRateList,
          remark: remark,
          difficultLevelRate: self.difficultLevelRate
        }, mode);
        totalOrderCount += obj.orderTotal;
        orderCountList.push(obj.orderTotal);

        var feedTotal = obj.feedTotal;
        if (feedTotal !== undefined) {
          totalFeedCount += feedTotal;
        }
        var yltsTotal = obj.yltsTotal;
        if (yltsTotal !== undefined) {
          totalYltsCount += yltsTotal;
        }
        materialColorDataList.push(obj);
      }
      self.materialColorDataList = materialColorDataList;
      self.orderTotal = totalOrderCount;
      self.feedTotal = _.round(totalFeedCount, 4);
      self.yltsTotal = _.round(totalYltsCount, 4);

      var materialTypeList = _.uniq(materialTypeList);
      self.materialTypeList = materialTypeList;
      var glassesMaterialTypeList = _.uniq(glassesMaterialTypeList);
      self.glassesMaterialTypeList = glassesMaterialTypeList;
      self.deliveryDateCount = deliveryDateCount;

      self.classifyMaterialData = new ClassifyMaterialDataModel(classifyMaterialList, {
        orderCountList: orderCountList,
        wasteRateList: wasteRateList,
        orderTotal: totalOrderCount
      });

      self.subsidiaryMaterialData = new SubsidiaryMaterialDataModel(subsidiaryMaterialList, 'create');
    },

    initOrderData: function (config, data) {
      var orderData = data.orderData;
      var materialList = orderData.materialBeans;
      var masterMaterialList = [],
        materialColorList = [],
        classfiyMaterialList = [],
        subsidiaryMaterialList = [];
      for (var i = 0; i < materialList.length; i++) {
        var material = materialList[i];
        var lineNo = material.lineNo;
        lineNo = Number(lineNo);
        var materialCode = material.materialCode;
        if (lineNo === -1) {
          if (materialCode === null) {
            masterMaterialList.push(material);
          } else {
            classfiyMaterialList.push(material);
          }
        } else if (lineNo >= 100 && lineNo !== 9999) {
          subsidiaryMaterialList.push(material);
        } else {
          materialColorList.push(material);
        }
      }

      var masterData = orderData.titleBean;
      this.initMasterData(masterData, masterMaterialList);

      var remarkList = config.materialColor.remarkList;
      var remarkGroup = _.groupBy(remarkList, 'lineNo');
      var materialColorGroup = _.groupBy(materialColorList, 'lineNo');
      var mode = self.mode;
      var materialColorDataList = [];
      var materialTypeList = [];
      var glassesMaterialTypeList = [];
      var deliveryDateCount = 0;
      for (var lineNo in materialColorGroup) {
        var remark = remarkGroup[lineNo];
        if (remark === undefined) {
          remark = '';
        } else {
          remark = remark[0].remark;
        }

        var obj = new MaterialColorData({
          lineNo: lineNo,
          materialColorList: materialColorGroup[lineNo],
          remark: remark
        }, mode);
        materialTypeList.pushArray(obj.getAllMaterialTypeList());
        glassesMaterialTypeList.pushArray(obj.getAllGlassesTypeList());
        materialColorDataList.push(obj);

        var count = obj.getDeliveryDateCount();
        if (deliveryDateCount < count) {
          deliveryDateCount = count;
        }
      }
      self.materialColorDataList = materialColorDataList;

      self.materialTypeList = _.uniq(materialTypeList);
      self.glassesMaterialTypeList = _.uniq(glassesMaterialTypeList);
      self.deliveryDateCount = deliveryDateCount;

      self.classifyMaterialData = new ClassifyMaterialDataModel(classfiyMaterialList);

      self.subsidiaryMaterialData = new SubsidiaryMaterialDataModel(subsidiaryMaterialList);
    },

    initMasterData: function (masterData, masterMaterialList) {
      var fields = ['sysOrderNo', 'orderNo', 'factoryNo', 'custmer', 'custmerOrderNo', 'custmerVersionNo', 'orderType', 'projectPicUrl',
        'custNo'
      ];
      self.setDataFromObj(masterData, fields, '');
      self.createUser = masterData.creater;
      self.approvalUser = masterData.auditor;
      self.businessId = masterData.businessId;

      var orderTime = masterData.orderTime;
      if (SysUtil.isEmpty(orderTime)) {
        orderTime = null;
      } else {
        orderTime = moment(orderTime).valueOf();
      }
      self.orderTime = orderTime;

      var orderRemark = masterData.custmerRemark;
      if (!SysUtil.isEmpty(orderRemark)) {
        var text = $(orderRemark).text();
        if (text.trim() === '') {
          orderRemark = '';
        }
      } else {
        orderRemark = '';
      }
      self.orderRemark = orderRemark;

      var deptId = masterData.deptId;
      self.proDept = Number(deptId);

      var deliveryTime = masterData.deliveryTime;
      self.deliveryTime = moment(deliveryTime).format('YYYY-MM-DD');

      var orderTotal = masterData.orderTotal;
      self.orderTotal = Number(orderTotal);

      var feedTotal = masterData.feedTotal;
      self.feedTotal = Number(feedTotal);

      var masterMaterialFields = ['ringSize', 'legSize'];
      masterMaterialFields.pushArray(OrderInfoConfigModel.orderMaterialFields);
      var orderInfoFieldObj = OrderInfoConfigModel.orderInfoFieldObj;
      var optionObj = {};
      for (var i = 0; i < masterMaterialFields.length; i++) {
        var field = masterMaterialFields[i];
        var label = orderInfoFieldObj[field];
        optionObj[label] = field;
        self[field] = '';
      }
      for (var i = 0; i < masterMaterialList.length; i++) {
        var obj = masterMaterialList[i];
        var field = optionObj[obj.materialType];
        if (field !== undefined) {
          self[field] = obj.materialModel;
        }
      }
    },

    getMaterialTypeFields: function (columns, materialType) {
      var mode = self.mode;
      if (mode !== 'test') {
        var materialTypeList = self.materialTypeList;
        if (materialTypeList.indexOf(materialType) === -1) {
          return [];
        }
      }

      var fieldList = [];
      for (var i = 0; i < columns.length; i++) {
        var column = columns[i];
        if (!column.isShow) {
          continue;
        }
        column = _.cloneDeep(column);
        var id = column.id;
        if (['orderTotal', 'feedTotal'].indexOf(id) !== -1) {
          column.align = 'center';
        }

        column.label = i18n.getMsg(`produceOrder.field.${id}`);
        column.key = `material_${materialType}_${id}`;
        fieldList.push(column);
      }
      return fieldList;
    },

    getDeliveryDateFields: function (columns, index) {
      var mode = self.mode;
      if (mode !== 'test') {
        var deliveryDateCount = self.deliveryDateCount;
        if (index >= deliveryDateCount) {
          return [];
        }
      }

      var fieldList = [];
      for (var i = 0; i < columns.length; i++) {
        var column = columns[i];
        if (!column.isShow) {
          continue;
        }

        column = _.cloneDeep(column);
        var id = column.id;
        column.label = i18n.getMsg(`produceOrder.field.${id}`);
        column.key = `deliveryDate_${index}_${id}`;
        fieldList.push(column);
      }
      return fieldList;
    },

    getCalssifyNotGroupFields: function (classifyConfig) {
      var obj = _.find(classifyConfig, {
        classifyName: 'noClassify'
      });
      if (obj === undefined) {
        return [];
      }

      var fieldObj = this.getCalssifyItemField(obj, false);
      if (fieldObj === null) {
        return [];
      }
      return [{
        id: SysUtil.getId(),
        fields: [fieldObj]
      }];
    },

    getCalssifyGroupFields: function (classifyConfig, rowNum) {
      var fieldList = [];
      var index = 0;
      for (var i = 0; i < classifyConfig.length; i++) {
        var classify = classifyConfig[i];
        var fieldObj = this.getCalssifyItemField(classify, true);
        if (fieldObj === null) {
          continue;
        }

        var fields;
        if (index % rowNum === 0) {
          fields = [];
          fieldList.push({
            id: SysUtil.getId(),
            fields: fields
          });
        } else {
          fields = fieldList[fieldList.length - 1].fields;
        }
        fields.push(fieldObj);
        index++;
      }

      if (fieldList.length > 0) {
        var lastField = fieldList[fieldList.length - 1].fields;
        var num = lastField.length;
        for (var i = num; i < rowNum; i++) {
          lastField.push({
            id: SysUtil.getId(),
            classifyName: '',
            columns: null
          });
        }
      }
      return fieldList;
    },

    getCalssifyItemField: function (classfiy, isGroup) {
      var classifyName = classfiy.classifyName;
      var mode = self.mode;
      if (mode !== 'test') {
        var classifyMaterialData = self.classifyMaterialData;
        if (!classifyMaterialData.hasClassify(classfiy, isGroup)) {
          return null;
        }
      }
      var columns = classfiy.columns;
      var columnList = [];
      for (var i = 0; i < columns.length; i++) {
        var column = columns[i];
        if (!column.isShow) {
          continue;
        }

        column = _.cloneDeep(column);
        var id = column.id;
        if (['orderTotal', 'feedTotal'].indexOf(id) !== -1) {
          column.align = "center";
        }

        if (id === 'remark') {
          column.label = i18n.getMsg(`produceOrder.field.classify-${id}`);
        } else {
          column.label = i18n.getMsg(`produceOrder.field.${id}`);
        }
        column.key = `${classifyName}_${id}`;
        columnList.push(column);
      }

      if (columnList.length === 0) {
        return null;
      }

      return {
        id: classifyName,
        classifyName: classifyName === 'noClassify' ? '无分类' : classifyName,
        columns: columnList
      };
    }
  };

  this.getTableHeaderList = function (materialColor) {
    var fieldList = materialColor.fieldList;
    var fields = [];
    for (var i = 0; i < fieldList.length; i++) {
      var fieldObj = fieldList[i];
      if (!fieldObj.isShow) {
        continue;
      }
      var id = fieldObj.id;
      if (id === 'material') {
        var materialTypeFields = this.getMaterialTypeFields(materialColor);
        fields.pushArray(materialTypeFields);
      } else if (id === 'glasses') {
        var glassesFields = this.getGlassesFields(materialColor);
        fields.push({
          id: id,
          columns: glassesFields
        });
      } else if (id === 'deliveryDate') {
        var deliveryDateFields = this.getDeliveryDateFields(materialColor);
        fields.pushArray(deliveryDateFields);
      } else {
        fields.push({
          id: id,
          width: fieldObj.width,
          label: fieldObj.label
        });
      }
    }
    return fields;
  };

  this.getMaterialTypeFields = function (materialColor) {
    var materialTypeConfig = materialColor.materialTypeConfig;
    var fieldList = [];
    for (var i = 0; i < materialTypeConfig.length; i++) {
      var material = materialTypeConfig[i];
      var materialType = material.materialType;
      var columns = material.columns;
      columns = fn.getMaterialTypeFields(columns, materialType);
      if (columns.length === 0) {
        continue;
      }
      fieldList.push({
        id: 'material',
        key: `material_${materialType}`,
        materialType: materialType,
        columns: columns
      });
    }
    return fieldList;
  };

  this.getGlassesFields = function (materialColor) {
    var glassesConfig = materialColor.glassesConfig;
    var fieldList = [];
    var glassesMaterialTypeList = this.glassesMaterialTypeList;
    var mode = this.mode;
    for (var materialType in glassesConfig) {
      var obj = glassesConfig[materialType];
      if (!obj.isShow) {
        continue;
      }
      if (mode !== 'test' && glassesMaterialTypeList.indexOf(materialType) === -1) {
        continue;
      }

      fieldList.push({
        id: `glasses_${materialType}`,
        key: `glasses_${materialType}`,
        materialType: materialType,
        width: obj.width
      });
    }
    return fieldList;
  };

  this.getDeliveryDateFields = function (materialColor) {
    var deliveryDateConfig = materialColor.deliveryDateConfig;
    var fieldList = [];
    for (var i = 0; i < deliveryDateConfig.length; i++) {
      var deliveryDate = deliveryDateConfig[i];
      var columns = deliveryDate.columns;
      columns = fn.getDeliveryDateFields(columns, i);
      if (columns.length === 0) {
        continue;
      }
      fieldList.push({
        id: 'deliveryDate',
        key: `deliveryDate_${i}`,
        label: '交期',
        columns: columns
      });
    }
    return fieldList;
  };

  this.addMaterialColorTestData = function () {
    var materialColorDataList = this.materialColorDataList;
    var data = new MaterialColorData({
      remark: ''
    }, 'test');
    materialColorDataList.push(data);
  };

  this.getClassifyMaterialFields = function (material) {
    var classifyConfig = material.classifyConfig;
    var fieldList = [];
    if (!material.isGroup) {
      fieldList = fn.getCalssifyNotGroupFields(classifyConfig);
    } else {
      fieldList = fn.getCalssifyGroupFields(classifyConfig, material.count);
    }
    return fieldList;
  };

  this.getMaterialData = function (fieldObj, isGroup) {
    if (this.mode === 'test') {
      return [{}];
    }

    var classifyMaterialData = self.classifyMaterialData;
    var materialData = classifyMaterialData.getMaterialList(fieldObj, isGroup);
    return materialData;
  };

  this.getRemarkList = function () {
    var materialColorDataList = this.materialColorDataList;
    var remarkList = [];
    if (this.mode === 'test') {
      for (var i = 0; i < materialColorDataList.length; i++) {
        var obj = materialColorDataList[i];
        remarkList.push({
          lineNo: i + 1,
          remark: obj.remark
        });
      }
    } else {
      for (var i = 0; i < materialColorDataList.length; i++) {
        var obj = materialColorDataList[i];
        remarkList.push({
          lineNo: obj.lineNo,
          remark: obj.remark
        });
      }
    }
    return remarkList;
  };

  this.checkValid = function () {
    var proDept = this.proDept;
    if (proDept === '') {
      return 'proDept';
    }
    return '';
  };

  this.getObject = function (mode) {
    var masterData = {
      deptId: this.proDept,
      custmerRemark: this.orderRemark,
      custNo: this.custNo
    };

    var orderTime = this.orderTime;
    if (orderTime !== null) {
      masterData.orderTime = moment(orderTime).format('YYYY-MM-DD');
    }

    if (mode === undefined) {
      mode = this.mode;
    }
    if (mode !== 'create') {
      masterData.creater = this.createUser;
    }
    if (mode === 'applyUpdate') {
      masterData.auditor = this.approvalUser;
    }
    var fields = ['sysOrderNo', 'orderNo', 'orderType', 'factoryNo', 'custmer', 'custmerVersionNo', 'custmerOrderNo', 'deliveryTime',
      'orderTotal', 'feedTotal', 'projectPicUrl'
    ];
    this.setPostData(masterData, fields);

    var materialList = [];
    var materialColorDataList = this.materialColorDataList;
    for (var i = 0; i < materialColorDataList.length; i++) {
      var materialColorData = materialColorDataList[i];
      var materialColorList = materialColorData.getObject({
        ringSize: this.ringSize,
        legSize: this.legSize
      });
      materialList.pushArray(materialColorList);
    }

    var classifyMaterialData = this.classifyMaterialData;
    var classifyMaterialList = classifyMaterialData.getObject({
      ringSize: this.ringSize,
      legSize: this.legSize
    });
    materialList.pushArray(classifyMaterialList);

    var subsidiaryMaterialData = this.subsidiaryMaterialData;
    var subsidiaryMaterialList = subsidiaryMaterialData.getObject({
      ringSize: this.ringSize,
      legSize: this.legSize
    });
    materialList.pushArray(subsidiaryMaterialList);

    materialList.push({
      lineNo: '-1',
      materialType: '圈开料尺寸',
      materialModel: this.ringSize,
      materialFactory: 3
    }, {
      lineNo: '-1',
      materialType: '肶开料尺寸',
      materialModel: this.legSize,
      materialFactory: 3
    });

    var orderFields = OrderInfoConfigModel.orderMaterialFields;
    var orderInfoFieldObj = OrderInfoConfigModel.orderInfoFieldObj;
    for (var i = 0; i < orderFields.length; i++) {
      var field = orderFields[i];
      var value = this[field];
      if (value.trim() === '') {
        continue;
      }
      var label = orderInfoFieldObj[field];
      materialList.push({
        lineNo: '-1',
        materialType: label,
        materialModel: value,
        materialFactory: 3
      });
    }

    return {
      titleBean: masterData,
      materialBeans: materialList
    };
  };

  this.getSpecialRemark = function (newData) {
    var newMaterialColorList = newData.materialColorDataList;
    var oldMaterialColorList = this.materialColorDataList;
    var specialRemarkList = [];
    for (var i = 0; i < oldMaterialColorList.length; i++) {
      var oldMaterialColor = oldMaterialColorList[i];
      var newMaterialColor = newMaterialColorList[i];
      var arr = oldMaterialColor.getSpecialRemarkData(newMaterialColor);
      specialRemarkList.pushArray(arr);
    }
    if (specialRemarkList.length === 0) {
      return '';
    }
    return specialRemarkList.join('|') + '|';
  };

  this.setCheckUpdate = function (oldData, config) {
    var orderInfoFieldObj = OrderInfoConfigModel.orderInfoFieldObj;
    var updateStatusObj = {};
    for (var field in orderInfoFieldObj) {
      var value = this[field];
      var oldValue = oldData[field];
      updateStatusObj[field] = value !== oldValue;
    }
    this.updateStatusObj = updateStatusObj;

    var materialColorConfig = config.materialColor;
    var materialColorDataList = this.materialColorDataList;
    var oldMaterialColorDataList = oldData.materialColorDataList;
    for (var i = 0; i < materialColorDataList.length; i++) {
      var materialColor = materialColorDataList[i];
      var oldMaterialColor = oldMaterialColorDataList[i];
      materialColor.setCheckUpdate(oldMaterialColor, materialColorConfig);
    }

    var classifyMaterialData = this.classifyMaterialData;
    var oldClassifyMaterialData = oldData.classifyMaterialData;
    classifyMaterialData.setCheckUpdate(oldClassifyMaterialData);
  };

  this.checkUpdate = function (field) {
    var updateStatusObj = this.updateStatusObj;
    if (updateStatusObj === undefined) {
      return false;
    }
    return updateStatusObj[field];
  };

  this.changeOrderTemplate = function (config) {
    var remarkList = config.materialColor.remarkList;
    var remarkGroup = _.groupBy(remarkList, 'lineNo');
    var materialColorDataList = this.materialColorDataList;
    for (var i = 0; i < materialColorDataList.length; i++) {
      var obj = materialColorDataList[i];
      var remark = remarkGroup[obj.lineNo];
      if (remark === undefined) {
        remark = '';
      } else {
        remark = remark[0].remark;
      }

      obj.remark = remark;
    }
  };

  fn.initData(config, data);
};
